home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / hdf3_2r2.lha / HDF3.2r2 / src / dfutil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-28  |  3.0 KB  |  109 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. #ifdef RCSID
  26. static char RcsId[] = "@(#)$Revision: 1.2 $";
  27. #endif
  28. /*
  29. $Header: /hdf/hdf/v3.2r2/src/RCS/dfutil.c,v 1.2 1992/10/12 18:11:51 koziol beta koziol $
  30.  
  31. $Log: dfutil.c,v $
  32.  * Revision 1.2  1992/10/12  18:11:51  koziol
  33.  * Updated for v3.2r2 release
  34.  *
  35.  * Revision 1.1  1992/08/25  21:40:44  koziol
  36.  * Initial revision
  37.  *
  38. */
  39. /*-----------------------------------------------------------------------------
  40.  * File:  dfutil.c
  41.  *
  42.  * Purpose:
  43.  *    General purpose utility routines, and callable versions of hdf utilities
  44.  *
  45.  * Invokes:
  46.  *    latest libdf.a
  47.  *
  48.  * Public functions:
  49.  *    DFUfindnextref - For this tag, find the ref after given ref
  50.  *
  51.  * Lower level functions:
  52.  *
  53.  * Private functions:
  54.  *
  55.  * Remarks:
  56.  *    This version assumes that all the values are floating point.
  57.  *--------------------------------------------------------------------------*/
  58.  
  59. #include "hdf.h"
  60. #include "herr.h"
  61.  
  62. /*-----------------------------------------------------------------------------
  63.  * Name:    DFfindnextref
  64.  * Purpose: For this tag, find the ref after lref
  65.  * Inputs:
  66.  *          file_id: handle to open HDF file
  67.  *          tag: tag to look for
  68.  *          lref: ref after which to search
  69.  * Returns: The desired ref if success, and FAIL on failure
  70.  * Users:   HDF users, utilities, other routines
  71.  * Invokes: HDvalidfid, 
  72.  * Remarks:
  73.  *---------------------------------------------------------------------------*/
  74.  
  75.  
  76. #ifdef PROTOTYPE
  77. uint16 DFfindnextref(int32 file_id, uint16 tag, uint16 lref)
  78. #else
  79. uint16 DFfindnextref(file_id, tag, lref)
  80.     int32 file_id;
  81.     uint16 tag, lref;
  82. #endif /* PROTOTYPE */
  83. {
  84.     char *FUNC="DFfindnextref";
  85.     uint16 newtag, newref;
  86.     int32 aid;
  87.  
  88.     HEclear();
  89.  
  90.     if (!HDvalidfid(file_id)) {
  91.         HERROR(DFE_ARGS);
  92.         return FAIL;
  93.     }
  94.  
  95.     aid = Hstartread(file_id, tag, lref);
  96.     if (aid == FAIL) 
  97.         return FAIL;
  98.  
  99.     if (Hnextread(aid, tag, DFREF_WILDCARD, DF_CURRENT) == FAIL) 
  100.         return FAIL;
  101.  
  102.     if (HQuerytagref(aid, &newtag, &newref) == FAIL)
  103.         return FAIL;
  104.  
  105.     return (newref);
  106. }
  107.  
  108.  
  109.